package calculator.controller;/*
 * @author     ：zhangbo
 * @date       ：Created in 2021/5/22 12:44
 * @description：负责处理用户单击等号按钮触发的ActionEvent事件。
 * @modified By：zhangbo
 * @version:     $
 */

import calculator.view.CalculatorWindows;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class HandleEquation extends HandleEvent {
    public HandleEquation(CalculatorWindows window) {
        super(window);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(!window.computer.operator.empty()) {
            String mess;

            mess = " " + window.computer.getTempResult() + " " + window.computer.getOperator() + ""
                    + window.computer.computerDataItem() + "=" + window.computer.getResult();


            window.saveComputerProcess.append("\n" + mess);

            window.computer.tempResult.pop();
            window.computer.operator.pop();
        }
    }
}
